// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate recommender;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// Log content of an action on a recommendation. This includes Mark* actions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ActionLog {
    /// Required. User that executed this action. Eg, foo@gmail.com
    pub actor: std::string::String,

    /// Required. State change that was made by the actor. Eg, SUCCEEDED.
    pub state: recommender::model::recommendation_state_info::State,

    /// Optional. Metadata that was included with the action that was taken.
    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Name of the recommendation which was acted on. Eg, :
    /// 'projects/123/locations/global/recommenders/roleReco/recommendations/r1'
    pub recommendation_name: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl ActionLog {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [actor][crate::model::ActionLog::actor].
    pub fn set_actor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.actor = v.into();
        self
    }

    /// Sets the value of [state][crate::model::ActionLog::state].
    pub fn set_state<
        T: std::convert::Into<recommender::model::recommendation_state_info::State>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_metadata][crate::model::ActionLog::state_metadata].
    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [recommendation_name][crate::model::ActionLog::recommendation_name].
    pub fn set_recommendation_name<T: std::convert::Into<std::string::String>>(
        mut self,
        v: T,
    ) -> Self {
        self.recommendation_name = v.into();
        self
    }
}

impl wkt::message::Message for ActionLog {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.recommender.logging.v1.ActionLog"
    }
}

/// Log content of an action on an insight. This includes Mark* actions.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct InsightActionLog {
    /// Required. User that executed this action. Eg, foo@gmail.com
    pub actor: std::string::String,

    /// Required. State change that was made by the actor. Eg, ACCEPTED.
    pub state: recommender::model::insight_state_info::State,

    /// Optional. Metadata that was included with the action that was taken.
    pub state_metadata: std::collections::HashMap<std::string::String, std::string::String>,

    /// Required. Name of the insight which was acted on. Eg, :
    /// 'projects/123/locations/global/insightTypes/roleInsight/insights/i1'
    pub insight: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl InsightActionLog {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [actor][crate::model::InsightActionLog::actor].
    pub fn set_actor<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.actor = v.into();
        self
    }

    /// Sets the value of [state][crate::model::InsightActionLog::state].
    pub fn set_state<T: std::convert::Into<recommender::model::insight_state_info::State>>(
        mut self,
        v: T,
    ) -> Self {
        self.state = v.into();
        self
    }

    /// Sets the value of [state_metadata][crate::model::InsightActionLog::state_metadata].
    pub fn set_state_metadata<T, K, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = (K, V)>,
        K: std::convert::Into<std::string::String>,
        V: std::convert::Into<std::string::String>,
    {
        use std::iter::Iterator;
        self.state_metadata = v.into_iter().map(|(k, v)| (k.into(), v.into())).collect();
        self
    }

    /// Sets the value of [insight][crate::model::InsightActionLog::insight].
    pub fn set_insight<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.insight = v.into();
        self
    }
}

impl wkt::message::Message for InsightActionLog {
    fn typename() -> &'static str {
        "type.googleapis.com/google.cloud.recommender.logging.v1.InsightActionLog"
    }
}
